<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Autocomplete</title>
    <link rel="stylesheet" href="css/jquery.autocomplete.css">
</head>
<body>
    <input type="text" id="tags">
    <button>ok</button>
</body>
<script src="../../js/jquery.min.js"></script>
<!-- <script src="js/jquery.ui.js"></script> -->
<script src="js/jquery.autocomplete.js"></script>
<script>
$(function(){
    var data = [
        "ActionScript",
        "AppleScript",
        "Asp",
        "BASIC",
        "我是谁",
        "对方噶哈",
        "仍有图为",
        "趣味体育",
        "C",
        "C++",
        "Clojure",
        "COBOL",
        "ColdFusion",
        "Erlang",
        "Fortran",
        "Groovy",
        "Haskell",
        "Java",
        "JavaScript",
        "Lisp",
        "Perl",
        "PHP",
        "Python",
        "Ruby",
        "Scala",
        "Scheme"
    ];
    $( "#tags" ).focus().autocomplete(
        data,
        {
            minChars:0,
            max:100,
            matchContains:true,
            scrollHeight:300,/*
            formatItem: function(row, i,max) { 
                var obj =eval("(" + row + ")"); //转换成js对象 
                return obj.Text; 
            }, 
                formatResult: function(row) { 
                var obj =eval("(" + row + ")"); //转换成js对象 
                return obj.Text; 
            } */
        }).result(function(event, item) { 
            var obj = eval("(" +item + ")"); //转换成js对象 
            $("#link").attr("href",obj.url); 
        }); 
})
</script>
</html>